package com.example.demo.controller;

import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/def")
public class
DefaultTypeController {
    //http://localhost:8080/def/reg
    @GetMapping("req")
    public String Testquest(HttpServletRequest request, HttpServletResponse response){
        System.out.printf(request.getMethod());//返回请求的HTTP方法
        return "Hello World";
    }
    @RequestMapping("req01")//RequestMapping可以接受任何请求eg:PUT,DELETE等.
    public String TestRequest01(HttpServletRequest request, HttpServletResponse response){
        String str = request.getMethod();
        System.out.printf(str);
        return "RequestMapping:"+str;
 }


}
